import Vue from 'vue'
import App from './App.vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import './assets/less/index.less'

import router from '../router'
import http from 'axios'
import {Loading} from "element-ui";
import store from '../store/index';
import backTop from '../views/components/backTop.vue'
import breadCrumb from '../views/components/breadCrumb'

//引入轮播图

Vue.config.productionTip = false
Vue.use(ElementUI)

Vue.component('backTop',backTop);
Vue.component('breadCrumb', breadCrumb);

Vue.prototype.$http = http

let loading;
let loadingNum=0;
export function startLoading() {
  if(loadingNum===0){
    loading = Loading.service({
      lock: true,
      text: '试卷生成中...',
      background:'rgba(255,255,255,0.5)',
    })
  }
  //请求数量加1
  loadingNum++;
}
export function endLoading() {
  //请求数量减1
  loadingNum--
  if(loadingNum<=0){
    loading.close()
  }
}

new Vue({
  router,
  store,
  render: h => h(App),
  beforeCreate() {
    this.__proto__.$bus = this;
  },
}).$mount('#app')
